package com.hnxxxy.usermgr.service;

import com.hnxxxy.entity.UserExample;
import com.hnxxxy.sysmgr.mapper.UserMapper;
import com.hnxxxy.usermgr.mapper.IUserMapper;
import com.hnxxxy.usermgr.pojo.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @CLASSDESCRIPER:
 * @AUTHOR:suhui
 * @PHONE:13319575368
 * @EMIAL:13319575368@163.COM
 * @DATE: 2020/3/31
 * @PARAMDESCRIPER:
 * @OUTPARAMDESCRIPER:
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service
public class UserService {
    Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private IUserMapper iuserMapper;

    @Autowired
    private UserMapper userMapper;

    public List<User> findAllUser() {

       return iuserMapper.findAllUser();
    }

    public List findUserByName(String name){
            UserExample example=new UserExample();
            example.setOrderByClause("id asc");
            example.setDistinct(true);
            UserExample.Criteria criteria = example.createCriteria();
            name="%" +name + "%";
            criteria.andNameLike(name);
            logger.info(name);
        return userMapper.selectByExample(example);
    }
}
